package org.cnc.explain.db.transaction.service;

import org.cnc.explain.db.transaction.entity.Account;

import java.io.IOException;
import java.math.BigDecimal;

public interface AccountService {

	/**
	 * 批量获取账户
	 *
	 * @param accountId
	 * @return 固定
	 */
	Account queryByAccountId(Integer accountId);


	/**
	 * 事务成功
	 *
	 * @param from
	 * @param to
	 * @param amount
	 * @return 固定
	 */
	Integer updateWithoutTransactional(Account from, Account to, BigDecimal amount);

	Integer updateTransactional(Account from, Account to, BigDecimal amount);

	/**
	 * 事务失败回滚
	 *
	 * @param from
	 * @param to
	 * @param amount
	 * @return 固定
	 * @throws IOException
	 */
	Integer transactionRollbackSuccess(Account from, Account to, BigDecimal amount) throws IOException;

	/**
	 * 事务失败回滚
	 *
	 * @param from
	 * @param to
	 * @param amount
	 * @return 固定
	 * @throws IOException
	 */
	Integer transactionRollbackFailure(Account from, Account to, BigDecimal amount) throws IOException;


	Integer programmerTransactionRollback(Account from, Account to, BigDecimal amount);

	Integer programmerTransactionNoneRollback(Account from, Account to, BigDecimal amount);

}
